package com.jxdinfo.hussar.cloud.module.example.tjjc.towerhistorycount.controller;

import com.jxdinfo.hussar.cloud.module.example.tjjc.towerhistorycount.model.TowerHistoryCount;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towerhistorycount.service.TowerHistoryCountService;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towerhistorycount.vo.TowerHistoryCountLineVO;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towerhistorycount.vo.TowerHistoryCountPageVO;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towerhistorycount.vo.TowerHistoryCountSearchVO;
import com.jxdinfo.hussar.cloud.module.example.tjjc.towerhistorycount.vo.TowerHistoryCountVO;
import com.jxdinfo.hussar.platform.core.base.apiresult.ApiResponse;
import com.jxdinfo.hussar.support.audit.core.annotations.AuditLog;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventGrade;
import com.jxdinfo.hussar.support.audit.core.enums.AuditEventType;
import com.jxdinfo.hussar.support.mp.base.controller.HussarBaseController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 塔机历史统计控制器
 */
@RestController(value = "tjjc.towerhistorycount.TowerHistoryCountController")
@AuditLog(moduleName = "塔机历史统计")
@RequestMapping(value = "/tjjc/towerHistoryCount")
public class TowerHistoryCountController extends HussarBaseController<TowerHistoryCount, TowerHistoryCountService> {

    private static final Logger logger = LoggerFactory.getLogger(TowerHistoryCountController.class);

    @Autowired
    private TowerHistoryCountService towerHistoryCountService;

    /**
     * 塔机功效分析折线图表
     *
     * @param towerHistoryCountSearchVO 入参
     * @return 查询结果
     */
    @AuditLog(moduleName = "塔机历史统计", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("findByLine")
    public ApiResponse<List<TowerHistoryCountLineVO>> findByLine(@RequestBody TowerHistoryCountSearchVO towerHistoryCountSearchVO) {
        if (towerHistoryCountSearchVO == null){
            return null;
        }
        //todo 没有获取项目编号工具类

        return towerHistoryCountService.findByLine(towerHistoryCountSearchVO);
    }

    /**
     * 获取工时列表分页
     *
     * @param towerHistoryCountSearchVO 入参
     * @return 查询结果
     */
    @AuditLog(moduleName = "塔机历史统计", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("findByPage")
    public ApiResponse<TowerHistoryCountPageVO> findByPage(@RequestBody TowerHistoryCountSearchVO towerHistoryCountSearchVO) {

        //todo 没有获取项目编号工具类

        return towerHistoryCountService.findByPage(towerHistoryCountSearchVO);
    }

    /**
     * 获取工时列表
     *
     * @param towerHistoryCountSearchVO 入参
     * @return 查询结果
     */
    @AuditLog(moduleName = "塔机历史统计", eventDesc = "表格查询", eventGrade = AuditEventGrade.SERVICE_LOG_TYPE, evnetType = AuditEventType.QUERY)
    @PostMapping("findByList")
    public ApiResponse<List<TowerHistoryCountVO>> findByList(@RequestBody TowerHistoryCountSearchVO towerHistoryCountSearchVO) {

        //todo 没有获取项目编号工具类

        return towerHistoryCountService.findByList(towerHistoryCountSearchVO);
    }
}
